<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
  xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
  layout:decorator="layout">
  <head>
    <title>首页</title>
    <script type="text/javascript" th:inline="javascript">
    	$(function(){
    		var flg = [[${flg}]];
    		var identityFlg = [[${identityFlg}]];
    		if(flg==1){
    			setMenu("比赛列表", true);
    			$('#flg').css("display","none");
    		}else{
    			if(identityFlg!=1){
    				$('#identityFlg').css("display","none");
    			}
    			setMenu("首页", true);
    		}
    		$.ajaxData({url:"/org/index/indexCount", success:function(ret){
    			$("#indexCount").loadData(ret);
    		}});
    		var date = new Date().getTime();
    		$("#page").page({url:"/org/index/getTableList",data:{type:''},success:function(obj){
    			$.each(obj.obj.content, function(i,v){
	    			if(date >= v.publishAt && date <= v.endAt){
	    				v.jx = 'true';
	    			}
	    			v.createdAt = new Date(v.createdAt).Format("yyyy.MM.dd");
	    			v.publishAt = new Date(v.publishAt).Format("yyyy.MM.dd");
	    			v.endAt = new Date(v.endAt).Format("yyyy.MM.dd");
	    			v.applyMoney = v.applyMoney == null ? "0.00" : v.applyMoney;
	    		});
    			obj.obj.showType=$("#page").getPageData()["type"];
    			$("#indexPage").loadData(obj.obj);
    			if(obj.code=="001" && obj.obj.content.length==0 ){
    				$('.detail-s-bar1').eq(1).click();
    			}
	    	}});
    		
    	 	 $("#identityFlg").on('click',function(){
    	 		location.href="/org/acc/authentication";
    	 	 });
    	});
    	
    	var findShowType = function(obj, showType){
    		if(showType=="Channel"){
        		$.ajaxData({url:"/org/index/indexCount",data:{flg:"1"},success:function(ret){
        			$("#indexCount").loadData(ret);
        		}});
        	}else{
        		$.ajaxData({url:"/org/index/indexCount", success:function(ret){
        			$("#indexCount").loadData(ret);
        		}});
        	}
        	$("#page").pageReload({type:showType});
        	$(".detail-s-bar1").removeClass("active");
        	$(obj).addClass("active");
        	
        	if(state=="Channel"){
        		$.ajaxData({url:"/org/index/indexCount",data:{flg:"1"},success:function(ret){
        			$("#indexCount").loadData(ret);
        		}});
        	}else{
        		$.ajaxData({url:"/org/index/indexCount", success:function(ret){
        			$("#indexCount").loadData(ret);
        		}});
        	}
    	}
    	
    	var findState = function(obj, state){
			$(".detail-s-bar3").removeClass("active");
        	$(obj).addClass("active");
        	$("#page").pageReload({state:state});
    	};
    </script>
  </head>
  
  <body>
    <div layout:fragment="content" class="content" id="modal">
			<div id="flg" class="modal">
				<div class="detail">
					<div class="jg">
						<div class="jg-row">
						<div class="jg-info">
							<span class="jg-info-label">机构名称：</span>
							<span class="jg-info-text" th:text="${session.user.name}">夏青杯</span>
						</div>
						<div class="jg-info">
							<span class="jg-info-label">机构ID：</span>
							<span class="jg-info-text" th:text="${session.user.id}">夏青杯</span>注册机构
						</div>
						<!-- <div class="jg-info">
							<a class="jg-btn" href="../../org/acc/brand">机构主页</a>
						</div> -->
						</div>
						<!-- <div class="jg-row">
							<a href="/org/evaluate/list-save" class="jg-addbs">发布比赛</a>
						</div> -->
					</div>
					<span class="jg-info-orther" ><a id="identityFlg" >注册机构</a></span>
				</div>
			</div>
			<div class="modal">
         		<div class="detail">  
         		
         		    <div class="detail-row1">
       				<div class="detail-s1">
       				    <span class="detail-s-bar1 active" onclick="findShowType(this,'')"><span class="detail-s-btn">我主办的比赛组</span></span>
       				    <span class="detail-s-bar1" onclick="findShowType(this,'Evaluate')"><span class="detail-s-btn">我主办的比赛</span></span>
						<span class="detail-s-bar1" onclick="findShowType(this,'Channel')"><span class="detail-s-btn">我推荐的比赛</span></span>
						<span class="detail-s-bar2"><p>筛选：</p></span>
						<span class="detail-s-bar3 active" onclick="findState(this, '')"><span class="detail-s-btn">全部</span></span>
       					<span class="detail-s-bar3" onclick="findState(this, 'Release')"><span class="detail-s-btn">已发布</span></span>
						<span style="border-right:none;" class="detail-s-bar3" onclick="findState(this, 'NotRelease')"><span class="detail-s-btn">未发布</span></span>
       				</div>
       				</div>
         		
         		    <div class="detail-top">
         				<label class="detail-title"><strong>关键数据</strong><i class="icon-help"></i></label>
         			</div>
         			<script type="text/template" id="indexCount">
         			<div class="detail-cont">
         				<div class="detail-c-box1">
         					<div class="detail-c">
         						<div class="detail-c-label">报名人数</div>
         						<div class="detail-c-count"><strong>#{applyCount}#</strong></div>
         						<div class="detail-c-day">
									<label class="detail-c-l">今日</label>
									<label class="detail-c-c">#{applyCountDay}#</label>
								</div>
         					</div>
         				</div>
         				<div class="detail-c-box1">
         					<div class="detail-c">
         						<div class="detail-c-label">作品帖数</div>
         						<div class="detail-c-count"><strong>#{blogCount}#</strong></div>
         						<div class="detail-c-day">
									<label class="detail-c-l">今日</label>
									<label class="detail-c-c">#{blogCountDay}#</label>
								</div>
         					</div>
         				</div>
         				<div class="detail-c-box1">
         					<div class="detail-c">
         						<div class="detail-c-label">收费总数</div>
         						<div class="detail-c-count"><strong>#{orderCount}#</strong></div>
         						<div class="detail-c-day">
									<label class="detail-c-l">今日</label>
									<label class="detail-c-c">#{orderCountDay}#</label>
								</div>
         					</div>
         				</div>
         				<div class="detail-c-box1">
         					<div class="detail-c">
         						<div class="detail-c-label">浏览总数</div>
         						<div class="detail-c-count"><strong>#{showCount}#</strong></div>
         						<div class="detail-c-day">
									<label class="detail-c-l">昨日</label>
									<label class="detail-c-c">#{showCountDay}#</label>
								</div>
         					</div>
         				</div>
         				<div class="detail-c-box1">
         					<div class="detail-c">
         						<div class="detail-c-label">打开总数</div>
         						<div class="detail-c-count"><strong>#{openCount}#</strong></div>
         						<div class="detail-c-day">
									<label class="detail-c-l">昨日</label>
									<label class="detail-c-c">#{openCountDay}#</label>
								</div>
         					</div>
         				</div>
         				<div class="detail-c-box1">
         					<div class="detail-c">
         						<div class="detail-c-label">互动总数</div>
         						<div class="detail-c-count"><strong>#{hdCount}#</strong></div>
         						<div class="detail-c-day">
									<label class="detail-c-l">昨日</label>
									<label class="detail-c-c">#{hdCountDay}#</label>
								</div>
         					</div>
         				</div>
         			</div>
         			</script>

         		    <div class="detail-row2"></div>

					<div class="table_list">
		               <div class="table-overflow">
		                   <table class="table">
		                       <thead>
		                           <tr>
		                               <th width="100px">比赛概况</th>
		                               <th></th>
		                               <th>比赛创建时间</th>
		                               <th>比赛系统时间</th>
		                               <th>发布状态</th>
		                               <th>账户身份</th>
		                               <th>比赛阶段</th>
		                               <th>报名人数</th>
		                               <th>收费</th>
		                               <th>操作</th>
		                           </tr>
		                       </thead>
		                       <tbody>
		                       <script type="template" id="indexPage">
								#for(data:content)#
								<tr>

<td>
<div class="info-cont">
	<div class="info-imgBox">
		<img class="img" src="#{data.img}#"/>
		#if(data.jx=='true')#
			<span class="label">进行中</span>
		#endif#
	</div>
</div>
</td>
<td>
<div class="info-detail2">
		<div class="info-cont-title"><strong>#{title}#</strong></div>
		<div class="info-cont-text">
		<div class="info-t">
		<label class="info-t-label">地点：</label>
		<span class="info-t-text">#{area}#</span>
		</div>
		<div class="info-t">
		<label class="info-t-label">时间：</label>
		<span class="info-t-text">#{timeInList}#</span>
		</div>
		<div class="info-t">
		<label class="info-t-label">主办方：</label>
		<span class="info-t-text">#{userOrganizaName}#</span>
		</div>
		<div class="info-t">
		<label class="info-t-label">报名费：</label>
		<span class="info-t-text">#{charge}#</span>
		</div>
	</div>
</td>

										<td>#{createdAt}#</td>
										<td>#{publishAt}# - #{endAt}#</td>
										<td>#{stateDesc}#</td>
                                        <td>
												#if(channel=='true')#我是渠道#endif#
												#if(channel=='false')#我是主办方#endif#
										</td>
                                        <td>#{evaluateCount}#</td>
										<td>#{applyCount}#</td>
										<td>#{applyMoney}#</td>
										<td>
											<div class="group-btn">
											#if(showType=='')#
												<div class=""><a class="btn" href="../evaluate/info?id=#{id}#">进入比赛组</a></div>
											#endif#
											#if(showType=='Channel')#
												<div class=""><a class="btn" href="../checkInformation/info?id=#{id}#">查看报名信息</a></div>
											#endif#
											#if(showType=='Evaluate')#
												<div class=""><a class="btn" href="/org/evaluate/detail/info?id=#{id}#">进入比赛</a></div>
											#endif#
											</div>
										</td>
									</tr>
								#endfor#
								</script>
		                     </tbody>
		                 </table>
		                 <div id="page"></div>
		             </div>
		          </div>
         		</div>
			</div>
    </div>
    
    <div layout:fragment="modals"></div>
  </body>
</html>